'''
Author: LHY 2601958675@qq.com
Date: 2023-07-18 15:03:17
LastEditors: LHY
LastEditTime: 2023-07-18 15:29:13
Description: pYquery第二次
'''
from pyquery import PyQuery

html = """
<HTML>
<div class="aaa">哒哒哒</div>
<div class="bbb">嘟嘟嘟</div>
</HTML>
"""
p = PyQuery(html)

p("div.aaa").after("""<div class="ccc">吼吼吼</div> """)
p("div.bbb").attr("id","aaa") #新增
p("div.bbb").attr("class","aaa") #修改
p("div.aaa").remove_attr("id") #删除
p("div.aaa").remove() #删除标签
print(p)